/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.edu.espe.distribuidas.aseguradora.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author pacodell
 */
@Entity
@Table(name = "detalle_factura", catalog = "distribuidasjsf", schema = "")
@NamedQueries({
    @NamedQuery(name = "DetalleFactura.findAll", query = "SELECT d FROM DetalleFactura d")})
public class DetalleFactura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_DETALLE2")
    private Integer codDetalle2;
    @Column(name = "ITEM_NUM_FAC")
    private Long itemNumFac;
    @Size(max = 250)
    @Column(name = "DESCRIPCION_FAC")
    private String descripcionFac;
    @Column(name = "CANTIDAD_FAC")
    private Long cantidadFac;
    @Column(name = "VALOR_UNITARIO_FAC")
    private Long valorUnitarioFac;
    @Column(name = "TOTAL_FAC")
    private Long totalFac;
    @JoinColumn(name = "NUM_FACTURA_SIN2", referencedColumnName = "NUM_FACTURA_SIN2")
    @ManyToOne
    private Factura numFacturaSin2;

    public DetalleFactura() {
    }

    public DetalleFactura(Integer codDetalle2) {
        this.codDetalle2 = codDetalle2;
    }

    public Integer getCodDetalle2() {
        return codDetalle2;
    }

    public void setCodDetalle2(Integer codDetalle2) {
        this.codDetalle2 = codDetalle2;
    }

    public Long getItemNumFac() {
        return itemNumFac;
    }

    public void setItemNumFac(Long itemNumFac) {
        this.itemNumFac = itemNumFac;
    }

    public String getDescripcionFac() {
        return descripcionFac;
    }

    public void setDescripcionFac(String descripcionFac) {
        this.descripcionFac = descripcionFac;
    }

    public Long getCantidadFac() {
        return cantidadFac;
    }

    public void setCantidadFac(Long cantidadFac) {
        this.cantidadFac = cantidadFac;
    }

    public Long getValorUnitarioFac() {
        return valorUnitarioFac;
    }

    public void setValorUnitarioFac(Long valorUnitarioFac) {
        this.valorUnitarioFac = valorUnitarioFac;
    }

    public Long getTotalFac() {
        return totalFac;
    }

    public void setTotalFac(Long totalFac) {
        this.totalFac = totalFac;
    }

    public Factura getNumFacturaSin2() {
        return numFacturaSin2;
    }

    public void setNumFacturaSin2(Factura numFacturaSin2) {
        this.numFacturaSin2 = numFacturaSin2;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codDetalle2 != null ? codDetalle2.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleFactura)) {
            return false;
        }
        DetalleFactura other = (DetalleFactura) object;
        if ((this.codDetalle2 == null && other.codDetalle2 != null) || (this.codDetalle2 != null && !this.codDetalle2.equals(other.codDetalle2))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ec.edu.espe.distribuidas.aseguradora.modelo.DetalleFactura[ codDetalle2=" + codDetalle2 + " ]";
    }
    
}
